from django.db import models


# Create your models here.
class Author(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=200)
    icon = models.FileField(null=True)
    phone = models.CharField(max_length=11)
    email = models.CharField(max_length=200)

    class Meta:
        db_table = 'author'


class Blog(models.Model):
    title = models.CharField(max_length=255)
    content = models.TextField()
    creat_time = models.DateTimeField(auto_now_add=True)
    updeat_time = models.DateTimeField(auto_now=True)
    author = models.ForeignKey(Author, on_delete=models.CASCADE)

    class Meta:
        db_table = 'blog'
